# 阶跃函数
def step_function(x):
    if x < 0 :
        return 1
    else:
        return 0

import numpy as np
def step_function(x):
    return np.array(x > 0, dtype=int)

# Sigmoid函数
def sigmoid(x):
    return 1 / (1 + np.exp(-x))

#ReLU函数
def relu(x):
    return np.maximum(0, x)

if __name__ == '__main__':
    x = np.array([0,1,2,3,4,5,-1,-2,-3,-4,-5])
    print(step_function(x))
    print(sigmoid(x))
    print(np.tanh(x))

    print(relu(x))